#include "addgroup.h"
#include "ui_addgroup.h"

addGroup::addGroup(SelfInfo info, TcpClient *tcp, QWidget *parent)
    : QWidget(parent), ui(new Ui::addGroup), t(tcp), info(info) {
    ui->setupUi(this);
    msgBox = new QMessageBox(this);
}

addGroup::~addGroup() { delete ui; }

void addGroup::on_pushButton_clicked() {
    json msg;
    msg.insert("msgid", static_cast<int>(EnMsgType::ADD_GROUP_MSG));
    msg.insert("groupid", ui->lineEdit->text().toInt());
    msg.insert("id", info.account);
    t->SendMsg(msg);
    msgBox->setText("添加群组成功！");
    msgBox->show();
    this->close();
}
